/**
 * 路由统一管理，配置实例：
 * https://www.npmjs.com/package/react-router-config
 */
import { lazy } from "react";
import { Redirect } from "react-router-dom";

const Home = lazy(() => import("@/views/home"));
const Home1 = lazy(() => import("@/views/home/c-pages/home1"));
const Home2 = lazy(() => import("@/views/home/c-pages/home2"));
const Home3 = lazy(() => import("@/views/home/c-pages/home3"));
const About = lazy(() => import("@/views/about"));

const routes = [
	// 重定向示例：
	{
		path: "/",
		exact: true,
		render: _ => {
			return <Redirect to="/home" />
		}
	},
	{
		path: "/home",
		component: Home,
		meta: {
			title: "首页"
		},
		routes: [
			{
				path: "/home",
				exact: true,
				render: _ => {
					return <Redirect to="/home/home1" />
				}
			},
			{
				path: "/home/home1",
				component: Home1,
			},
			{
				path: "/home/home2",
				component: Home2,
			},
			{
				path: "/home/home3",
				component: Home3,
			}
		]
	},
	{
		path: "/about",
		component: About,
		meta: {
			title: "关于"
		}
	}
]

export default routes;
